<template>
  <div id="app">
    <el-container style=" border: 1px solid #eee;" class="app-breadcrumb">
      <el-aside width="200px" style="background-color: rgb(238, 241, 246)" class="e-side">
        <el-menu router>
          <el-submenu v-for="(item,index) in $router.options.routes" :index="index+''" v-if="item.show">
            <template slot="title"><i class="el-icon-message"></i>{{ item.name }}</template>
            <el-menu-item v-for="(item1,index2) in item.children" :index="item1.path"
                          :class="$route.path==item1.path?'is-active':''" v-if="item1.show">{{ item1.name }}
            </el-menu-item>
          </el-submenu>
        </el-menu>
      </el-aside>

      <!--    <el-breadcrumb class="app-breadcrumb" separator="/">
            <transition-group name="breadcrumb">
              <el-breadcrumb-item v-for="(item,index) in levelList" :key="item.path">
                <span v-if="item.redirect==='noRedirect'||index==levelList.length-1" class="no-redirect">{{ item.meta.title }}</span>
                <a v-else @click.prevent="handleLink(item)">{{ item.meta.title }}</a>
              </el-breadcrumb-item>
            </transition-group>
          </el-breadcrumb>-->
      <el-container>
        <el-header style="text-align: right; font-size: 12px">
          <el-dropdown>
            <i class="el-icon-setting" style="margin-right: 15px"></i>
            <el-dropdown-menu slot="dropdown" >
              <el-dropdown-item><el-button  @click="outLogin()" style="height: 40px;border: 1px">退出</el-button></el-dropdown-item>
              <el-dropdown-item><el-button  @click="returnHome()" style="height: 40px;border: 1px">返回首页</el-button></el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
          <span>{{this.$store.getters.getUser.loginname}}</span>
        </el-header>
        <el-main class="e-main">
          <router-view/>
        </el-main>
      </el-container>


    </el-container>
  </div>
</template>


<style>

.el-header, .el-footer {
  background-color: #B3C0D1;
  color: #333;
  text-align: center;
  line-height: 60px;
}

/*.el-aside {
  background-color: #D3DCE6;
  color: #333;
  text-align: center;
  line-height: 200px;
}*/

.el-main {
  background-color: #E9EEF3;
  color: #333;
  /*text-align: center;*/
  padding: 0;
  margin: 0;
}
  .el-header {
    background-color: #B3C0D1;
    color: #333;
    line-height: 60px;
  }

  /*.el-aside {
    color: #333;
  }*/
  .app-breadcrumb .el-aside {
    display: inline-block;
    font-size: 14px;
    line-height: 50px;
    margin-left: 8px;
  }

  .no-redirect {
    color: #97a8be;
    cursor: text;
  }

  /**e-side{
    margin: 0;
    padding: 0;
  }*/
  /*.e-side{
    width:100%;
    height: 100%;
    background: yellow;
    position: absolute;
  }*/
  /*#app{
    height: 100%;
    position: absolute;
    top: 0px;
    left: 0px;
    width: 100%;
  }*/
  .e-main{
    min-height: 500px;
  }

</style>

<script>
export default {
  name: "Background",
  data() {
    const item = {
      date: '2016-05-02',
      name: '王小虎',
      address: '上海市普陀区金沙江路 1518 弄'
    };
    return {
      tableData: Array(20).fill(item)
    }
  },
  methods:{
    outLogin(){
      sessionStorage.clear();
      this.$router.push('/');
    },
    returnHome(){
      this.$router.push('/');
    }
  }
};


</script>
